From 8442e529f5504a7e80a5aa02a3b57a2f584f7a42 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Thu, 18 Aug 2005 19:04:47 +0000 Subject: [PATCH] Create devices for the xenbus-bus's. Signed-off-by: Christian Limpach --- .../drivers/xen/xenbus/xenbus_probe.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index 331ef7f150..3a37014c0b 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -72,6 +72,7 @@ struct xen_bus_type int (*get_bus_id)(char bus_id[BUS_ID_SIZE], const char *nodename); int (*probe)(const char *type, const char *dir); struct bus_type bus; + struct device dev; }; /* device// => - */ @@ -103,6 +104,9 @@ static struct xen_bus_type xenbus_frontend = { .name = "xen", .match = xenbus_match, }, + .dev = { + .bus_id = "xen", + }, }; /* For backends, does lookup on uuid (up to /). Returns domid, or -errno. */ @@ -160,6 +164,9 @@ static struct xen_bus_type xenbus_backend = { .name = "xen-backend", .match = xenbus_match, }, + .dev = { + .bus_id = "xen-backend", + }, }; static int xenbus_dev_probe(struct device *_dev) @@ -304,16 +311,17 @@ static int xenbus_probe_node(struct xen_bus_type *bus, xendev->subtype = xenbus_read(xendev->nodename, "subtype", NULL); if (IS_ERR(xendev->subtype)) xendev->subtype = NULL; - + + xendev->dev.parent = &bus->dev; + xendev->dev.bus = &bus->bus; + xendev->dev.release = xenbus_release_device; + err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename); if (err) { kfree(xendev); return err; } - xendev->dev.bus = &bus->bus; - xendev->dev.release = xenbus_release_device; - /* Register with generic device framework. */ err = device_register(&xendev->dev); if (err) { @@ -584,6 +592,8 @@ static int __init xenbus_probe_init(void) { bus_register(&xenbus_frontend.bus); bus_register(&xenbus_backend.bus); + device_register(&xenbus_frontend.dev); + device_register(&xenbus_backend.dev); if (!xen_start_info.store_evtchn) return 0; -- 2.30.2